//
//  MFWMessagenCenter.h
//  MFWSdk
//
//  Created by Song Xiaofeng on 13-9-13.
//  Copyright (c) 2013年 Mafengwo Inc. All rights reserved.
//

#import <Foundation/Foundation.h>

extern NSString *const MFWMessageCenterUnreadMessageCountInMessageCenterDidChange;

@interface MFWMessageCenter : NSObject
{
    
}

@property (nonatomic,copy) BOOL(^blockCanHandlePushNotificationUrl)(NSString* url);// 询问推送消息url是否可以处理，如果返回true，则不使用SDK的实现
@property (nonatomic,copy) BOOL(^blockCanHandlePushNotificationJump)(NSString* type,NSDictionary* param);// 询问跳转类型是否可以处理，如果返回true，则不使用SDK的实现

@property (nonatomic,copy) BOOL(^blockCanHandlePushNotificationJumpValues)(NSString* type,NSArray* paramValue);// 询问跳转类型是否可以处理，如果返回true，则不使用SDK的实现

+ (MFWMessageCenter *)sharedInstance;

- (void)setMessage:(MSMessage*)message isRead:(BOOL)isRead;
- (void)markAllMessageHasBeenRead;

// 异步上传即时消息接口 added by hanxin 20130621
- (void)sendFeedBackMessage:(NSString*)message completion:(void(^)(BOOL success, NSError* error))completion;
// 请求全部类型的消息（根据时间戳增量获取） added by hanxin 20130621
- (MFWHttpRequest*)requestMessageMoreListCompletion:(void(^)(BOOL success, NSArray* array,NSError* error))handler;
// 请求指定类型的消息（根据时间戳增量获取）（实际上会取msg_type=all，然后挑出需要的消息类型通过回调返回） added by hanxin 20130621
- (MFWHttpRequest*)requestMessageMoreListByMessageType:(NSString*)msgType completion:(void (^)(BOOL, NSArray *, NSError *))handler;

// 获取本地已取到的消息（排除意见反馈类型中的用户发送的）：所有类型  added by hanxin 20130621
- (NSArray*)getMessageListInMessageCenter;
// 消息中心中，未读消息数量
- (NSInteger)getUnreadMessageCountInMessageCenter;
// 获取本地已取到的消息：指定类型  added by hanxin 20130621
- (NSArray*)getMessageListByMsgType:(NSString*)msgType;
- (NSArray*)getMessageListByMsgType:(NSString*)msgType isRead:(BOOL)aIsRead;

- (void)clearCache;
#pragma mark - 远程服务-推送通知相关
// iOS设备注册更新接口
- (void)registerDeviceToken:(NSData*)deviceTokenData withInfo:(NSDictionary *)info;

// 分析接收的消息，执行相应的动作
- (void)processRemoteNotificationWithCommand:(NSDictionary *)userInfo fromLaunch:(BOOL)bFromLaunch;
@end
